package com.myboot.config;

import com.myboot.interceptor.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 将自定义的拦截器注册到容器中，
 * 可以多次添加不同的拦截器实例，以实现拦截器链
 * excludePathPatterns 排除拦截
 * Created by liuhuan on 2017/1/11.
 */
@Configuration
public class InterceptorConfigure extends WebMvcConfigurerAdapter {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
